import time

from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

driver = webdriver.Chrome()
wait = WebDriverWait(driver, 10)

driver.get("https://ceshiren.com")
driver.find_element(By.CSS_SELECTOR, "#search-button").click()
driver.find_element(By.CSS_SELECTOR, "#search-term").send_keys("ChromeDriver")
driver.find_element(By.CSS_SELECTOR, "a.widget-link.show-advanced-search").click()
wait.until(
    EC.element_to_be_clickable((By.XPATH, '//span[text()="搜索"]'))
).click()
text1 = "selenium&chromedriver安装配置ok，在pycharm中执行代码失败，报错：’chromedriver’ executable needs to be in Path"
text2 = wait.until(
    EC.visibility_of_element_located((By.XPATH, '//span[text()="安装配置ok，在pycharm中执行代码失败，报错：’"]'))
)
assert text1 == text2.text
driver.quit()